﻿<UserControl x:Class="Sentinel.Logs.Gui.SetLoggerNamePage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="300"
             Loaded="PageLoaded">

    <UserControl.Resources>
        <Style x:Key="textBoxInError"
               TargetType="{x:Type TextBox}">
            <Style.Triggers>
                <Trigger Property="Validation.HasError"
                         Value="true">
                    <Setter Property="ToolTip"
                            Value="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors).CurrentItem.ErrorContent}" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>

    <Grid Margin="4">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <TextBlock Grid.ColumnSpan="2"
                   Margin="5,5,5,15"
                   VerticalAlignment="Bottom"
                   Text="Each logger should be given a unique name, ideally named after something appropriate for your system."
                   TextWrapping="WrapWithOverflow" />
        <TextBlock Text="Log Name : "
                   Grid.Row="1"
                   Margin="3"
                   VerticalAlignment="Center" />
        <TextBox Margin="3"
                 Grid.Row="1"
                 Grid.Column="1"
                 Style="{StaticResource textBoxInError}"
                 VerticalAlignment="Center"
                 Text="{Binding Path=LogName, 
                                ValidatesOnDataErrors=True, 
                                Mode=TwoWay, 
                                UpdateSourceTrigger=PropertyChanged}" />
    </Grid>
</UserControl>
